<?php

namespace App\Admin\Controllers;

use App\Admin\Repositories\HospitalAppoint;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;

class HospitalAppointController extends AdminController
{
    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(new HospitalAppoint(), function (Grid $grid) {
            $grid->column('id')->sortable();
            $grid->column('type');
            $grid->column('cycle');
            $grid->column('delay');
            $grid->column('add_num');
            $grid->column('hospital_id');
            $grid->column('sure_date');
            $grid->column('non_date');
            $grid->column('weeks');
            $grid->column('intro');
            $grid->column('is_delete');
            $grid->column('is_open');
            $grid->column('extend_day');
            $grid->column('release_time');
            $grid->column('is_month');
            $grid->column('phone');
            $grid->column('created_at');
            $grid->column('updated_at')->sortable();
        
            $grid->filter(function (Grid\Filter $filter) {
                $filter->equal('id');
        
            });
        });
    }

    /**
     * Make a show builder.
     *
     * @param mixed $id
     *
     * @return Show
     */
    protected function detail($id)
    {
        return Show::make($id, new HospitalAppoint(), function (Show $show) {
            $show->field('id');
            $show->field('type');
            $show->field('cycle');
            $show->field('delay');
            $show->field('add_num');
            $show->field('hospital_id');
            $show->field('sure_date');
            $show->field('non_date');
            $show->field('weeks');
            $show->field('intro');
            $show->field('is_delete');
            $show->field('is_open');
            $show->field('extend_day');
            $show->field('release_time');
            $show->field('is_month');
            $show->field('phone');
            $show->field('created_at');
            $show->field('updated_at');
        });
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        return Form::make(new HospitalAppoint(), function (Form $form) {
            $form->display('id');
            $form->text('type');
            $form->text('cycle');
            $form->text('delay');
            $form->text('add_num');
            $form->text('hospital_id');
            $form->text('sure_date');
            $form->text('non_date');
            $form->text('weeks');
            $form->text('intro');
            $form->text('is_delete');
            $form->text('is_open');
            $form->text('extend_day');
            $form->text('release_time');
            $form->text('is_month');
            $form->text('phone');
        
            $form->display('created_at');
            $form->display('updated_at');
        });
    }
}
